package tgc.edu.exam.service;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import tgc.edu.exam.custom.CommonService;
import tgc.edu.exam.entity.Permission;
import tgc.edu.exam.repository.PermissionRepository;
import tgc.edu.exam.repository.SysRoleRepository;


@Service
public class PermissionService extends CommonService<Permission, UUID>{
	@Autowired
	private PermissionRepository permissionDAO;
	@Autowired
	private SysRoleRepository sysRoleDAO;
	
	public Permission findByCode(String code) {
		
		return permissionDAO.findByCode(code);
	}
	@Transactional
	public void roleChangeCode(String oldCode, String newCode) {
		sysRoleDAO.changeCode(oldCode,newCode);
		
	}
	@Transactional
	public void roleChangeName(String oldName, String newName) {
		sysRoleDAO.changeName(oldName,newName);
		
	}

}
